import { request } from '@/utils/request';
import type { PaymentInfoListDto ,PaymentInfoEditDto,AppInfoDto,AppInfoEditDto} from '@/api/model/settingsModel';

const Api = {
  PaymentList:'/payment/list',
  PaymentInfo:'/payment/detail',
  SavePaymentInfo:'/payment/save',
  AppInfo:'/payment/app',
  AppList:'/payment/app/list',
  SaveAppInfo:'/payment/app/save'
};

export function getList() {
  return request.get<PaymentInfoListDto>({
    url: Api.PaymentList,
  });
};

export function getPayment(mchId:string)
{
  return request.get<PaymentInfoEditDto>({
    url:Api.PaymentInfo+`?mchid=${mchId}`
  })
};
export function savePayment(data:PaymentInfoEditDto)
{
  return request.post({
    url:Api.SavePaymentInfo,
    data:data
  })
};


export function getAppList()
{
  return request.get<AppInfoDto[]>({
    url:Api.AppList
  })
}
export function getApp(appId:string)
{
  return request.get<AppInfoEditDto>({
    url:Api.AppInfo+'?appid='+appId
  });
}
export function saveApp(info:any){
  return request.post({
    url:Api.SaveAppInfo,
    data:info
  })
}
export function delApp(appId:string){
  return request.delete({
    url:Api.AppInfo+"?appid="+appId
  })
}
